{extend name="default/template/base_index" /}

{block name="area_header"}
{/block}

{block name="area_body"}
{include file="default/Widget/topbar" /}
<div class="admin-main container-fluid">
  {include file="default/Widget/left" /}
  <div class="admin-main-content">
  {include file="default/Widget/breadcrumb" /}
    <div class="table-responsive well">
      <h2>题目添加</h2>
       <!-- 过滤\查询按钮 -->
      <div class="filter-controls">
        <form action="{:url('Testpaper/question',['parent'=>$parent])}" class="memberForm form-inline" method="get">
          <input type="hidden" name="id" value="{$test_id}" />

          <div class="form-group">
            <label class="control-label">标识</label>
            <div class="input-group">
              <input class="form-control" type="text" name="kword" placeholder="标识" value="{$kword|default=''}"/>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label"></label>
            <div class="input-group">
              <select class="form-control" name="dt_type" id="js-dt-type"/>
               <option value="0">== 类型 ==</option>
              {volist name="dt_types" id="v"}
              <option value="{$v.id}"  {eq name="v['id']" value="$dt_type"}selected{/eq} >{$v.name}</option>
              {/volist}
              </select>
            </div>
          </div>
          <div class="form-group">
            <label class="control-label">&nbsp;</label>
            <div class="input-group">
              <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-search"></i>查询</button>
            </div>
          </div>
        </form>
      </div>
      <!-- 操作按钮 -->
      <div class="btn-controls">
          <a href="javascript:history.go(-1);" class="btn btn-default btn-sm"><i class="fa fa-reply"></i>返回</a>
      </div>

      <table class="table table-striped table table-hover  table-condensed">
          <thead>
          <tr>

            <th>ID</th>
            <th>标识</th>
            <th>类型</th>
            <th>状态</th>

            <th>添加题目</th>
          </tr>
          </thead>
          <tbody>
            {empty name="list"}
            <tr>
              <td colspan="7" class="text-center">{:L('NO_DATA')}</td>
            </tr>
            {else/}
            {volist name="list"  id="vo"}
            <form class="select_{$vo.id}">
              <input type="hidden" name="question_id" value="{$vo['id']}" />
              <input type="hidden" name="test_id" value="{$test_id}" />
            <tr>

              <td data-id="{$vo['id']}">
                <a href="{:url('Testpaper/question',['parent'=>$vo['id'],'id'=>$test_id,'dt_type'=>$dt_type])}">{$vo['id']}</a></td>
              <td>
                {$vo['note']|default=''}</td>
              <td>
                {:$dt_types[$vo['dt_type']]['name']}</td>
              <td>
                {if condition="$vo['status'] eq 0"}起草
                {elseif condition="$vo['status'] eq 1" /}发布
                {else /}未知{/if}</td>
            </form>

              <td>
                <a target-form="select_{$vo.id}" class="ajax-post btn btn-primary btn-sm"
                   href="{:url('Testpaper/question')}"><i class="fa fa-save"></i>{:L('BTN_ADD')}</a>

              </td>
            </tr>

            {/volist}
            {/empty}
          </tbody>
      </table>
      <div>{$show}</div>
    </div>
  </div>
  <!-- END admin-main-content -->
</div>
<!-- END admin-main-->
{/block}

{block name="area_footer"}
<script>

</script>
{/block}